package cn.mccraft.uide.api.property.value;

public abstract class BaseValue<T> implements Value<T> {

	private T value;

	public BaseValue() {
		this(null);
	}

	public BaseValue(T initialValue) {
		setValue(initialValue);
	}

	@Override
	public T getValue() {
		return value;
	}

	@Override
	public void setValue(T value) {
		this.value = value;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(!(obj instanceof Value<?>))
			return false;
		
		Value<?> property = (Value<?>) obj;
		
		return getValue().equals(property.getValue());
	}
	
	@Override
	public int hashCode() {
		return value.hashCode();
	}
}
